<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/tip.css" />
<script src="js/xheditor/jquery/jquery-1.4.4.min.js"></script>
<title>问卷管理__问卷题目预览</title>
<style>
.input_text{
	border:0;
	border-bottom:1px solid black;
	background:#ffffff;
	width:200px;
	height:20px;
}
</style>
</head>
<body>
	<div id="wrap">
		<?php 
            if($isanswer=='no' && empty($look) && empty($sid)){
       	?>
    		<div id="public_head"></div>
    	<?php }?>
        <div class="m_search qq_bh">
        	<span class="red"><b><?php echo $quesnr['TITLE'];?></b></span>  &nbsp;
        <?php 
            	if($isanswer=='no' && $quesnr['STATE']!=3 && empty($look) && empty($sid)){
       	?>
        	<a href="/index.php?c=quesnr&a=addstep2&id=<?php echo $id;?>">题目修改或添加</a>
        <?php 
            	}
        ?>
        </div>
        <form action='' method='post' id='form'>
        <div class="m_revise" id="revise">
        	<div class="field">
                <div class="itemText">
                	<span><?php echo $quesnr['NOTE']?></span>
                </div>
            </div>
        
        <?php 
        	if(is_array($qids) && count($qids)>0){
        		$i=1;
        		foreach ($qids as $v){
        ?>
        	<div class="field">
                <h2 class="itemTitle"><?php echo $i++.'、'.$allAquest[$v]['TITLE'];?>&nbsp;<?php if($allAquest[$v]['ALLOW_NULL']!='1'){echo '<font color=red>*</font>';}?><!-- <a href="">删除</a>--></h2>
                <div class="itemText">
                	<?php 
                		if($allAquest[$v]['QTYPE']>2){
                			$check = $allAquest[$v]['ALLOW_NULL']!='1'?' check="empty" ':'';
                			switch ($allAquest[$v]['QTYPE']){
                				case '3':echo '<div class="List-Item"><input class="input_text" type="text" '.$check.' value="'.$surveyinfo[$v][0].'" name="answer['.$v.'][]"></div>';break;
                				case '4':echo '<textarea rows="6" cols="100" onpropertychange="if(this.scrollHeight>100) this.style.posHeight=this.scrollHeight+5" '.$check.' name="answer['.$v.'][]" id="advice" class="textarea">'.$surveyinfo[$v][0].'</textarea>';break;
                				default:echo '';
                			}
                		}else{
                		foreach ($allOpt as $val){
                			if($val['QID'] == $v){
                	?>
                    	<div class="List-Item">
                    		<input type="<?php echo $optarr[$allAquest[$v]['QTYPE']]?>" 
                    		<?php 
                    			if(is_array($surveyinfo) && count($surveyinfo[$v])>0){
                    					if(in_array($val['OID'],$surveyinfo[$v]))echo ' checked ';
                    			}
                    		?> value="<?php echo $val['OID']?>" name="answer[<?php echo $v;?>][]">&nbsp;<?php echo $val['ONAME']?>
                    		<?php 
                    			if(1==$val['INPUT']){
                    				echo "<input type='text' onblur='check_input(this);' class='input_text' value='".$surveyinfo[$v]['input'][$val['OID']]."' name=\"answer[".$v."][input][".$val['OID']."]\"></input>";
                    			}
                    			?>
                    	</div>
                    <?php 
                			}
                		}
                		}
                    ?>
                </div>
            </div>
        <?php 
        		}
        	}else{
        ?>
            <div class="field">
                <h2 class="itemTitle">该问卷还没有选择题目, <a href="/index.php?c=quesnr&a=addstep2&id=<?php echo $id;?>">现在去选题</a></h2>
            </div>
        <?php }?>
            <div class="field" style="border-bottom: 0px dashed #BCBCBC;">
            	<div class="itemText">
            	<?php 
            	if($isanswer=='no'){
            		if($quesnr['STATE']==2 && empty($sid) && empty($look)){
            	?>
            	<a href="/index.php?c=quesnr&a=issue&id=<?php echo $id;?>">
            		<input class="btn_gray" name="" type="button" onclick="return T.confirm('确认发布吗？');" value="立即发布"/>
            	</a>
            	<?php 
            		}elseif(empty($look)){
            	?>
            	<a href="###">
            		<input class="btn_gray" name="" type="button" onclick="location.href='/index.php?c=quesnr&a=index'" value="返 回"/>
            	</a>
            	<?php 
            		}else{
            	?>
            	<a href="###">
            		<input class="btn_gray" name="" type="button" onclick="window.close();" value="关 闭"/>
            	</a>	
            <?php
            		} 
            	}else{
            	?>
            		<input class="btn_gray" name="sub_answer" type="submit"  value="提交答卷"/>
            	<?php }?>
            	</div>
            </div>
            </form>
        </div>
    </div>
<script>
function openDialog(type){
	switch(type){
		case 3:
		art.dialog({title:'消息提示',content:'questnSys.html',okvalue:'确认',ok:function(){return true;}});
		break;
		}
	}
</script>
</body>
</html>
<script src="js/boot.js"></script>
<script src="js/tip.js"></script>
<script src="js/checkform.js"></script>
<?php 
    	if($isanswer=='no'){
?>
	<script src="/js/add_public_head.js" type="text/javascript"></script>
<?php 
	}else{
?>
<script type='text/javascript'>
	var key = $('form').serialize();
	$('input.btn_gray').click(function (){
		var vkey = $('form').serialize();
		if(key == vkey){
			alert('请填完题后再提交')
			return false;
		}
	})
</script>
<?php }?>
<script>
function check_input(t){
	if($(t).val()!=''){
		$(t).parent().children()[0].checked=true;
	}
}
</script>